home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / KERNEL.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  96 lines

  1. #ifndef _LINUX_KERNEL_H
  2. #define _LINUX_KERNEL_H
  3.  
  4. /*
  5.  * 'kernel.h' contains some often-used function prototypes etc
  6.  */
  7.  
  8. #ifdef __KERNEL__
  9.  
  10. #include <stdarg.h>
  11. #include <linux/linkage.h>
  12.  
  13. /* Optimization barrier */
  14. /* The "volatile" is due to gcc bugs */
  15. #define barrier() __asm__ __volatile__("": : :"memory")
  16.  
  17. #define INT_MAX        ((int)(~0U>>1))
  18. #define UINT_MAX    (~0U)
  19. #define LONG_MAX    ((long)(~0UL>>1))
  20. #define ULONG_MAX    (~0UL)
  21.  
  22. #define STACK_MAGIC    0xdeadbeef
  23.  
  24. #define    KERN_EMERG    "<0>"    /* system is unusable            */
  25. #define    KERN_ALERT    "<1>"    /* action must be taken immediately    */
  26. #define    KERN_CRIT    "<2>"    /* critical conditions            */
  27. #define    KERN_ERR    "<3>"    /* error conditions            */
  28. #define    KERN_WARNING    "<4>"    /* warning conditions            */
  29. #define    KERN_NOTICE    "<5>"    /* normal but significant condition    */
  30. #define    KERN_INFO    "<6>"    /* informational            */
  31. #define    KERN_DEBUG    "<7>"    /* debug-level messages            */
  32.  
  33. # define NORET_TYPE    /**/
  34. # define ATTRIB_NORET  __attribute__((noreturn))
  35. # define NORET_AND     noreturn,
  36.  
  37. #ifdef __i386__
  38. #define FASTCALL(x)    x __attribute__((regparm(3)))
  39. #else
  40. #define FASTCALL(x)    x
  41. #endif
  42.  
  43. extern void math_error(void);
  44. NORET_TYPE void panic(const char * fmt, ...)
  45.     __attribute__ ((NORET_AND format (printf, 1, 2)));
  46. NORET_TYPE void do_exit(long error_code)
  47.     ATTRIB_NORET;
  48. extern unsigned long simple_strtoul(const char *,char **,unsigned int);
  49. extern long simple_strtol(const char *,char **,unsigned int);
  50. extern int sprintf(char * buf, const char * fmt, ...);
  51. extern int vsprintf(char *buf, const char *, va_list);
  52.  
  53. extern int session_of_pgrp(int pgrp);
  54.  
  55. asmlinkage int printk(const char * fmt, ...)
  56.     __attribute__ ((format (printf, 1, 2)));
  57.  
  58. #if DEBUG
  59. #define pr_debug(fmt,arg...) \
  60.     printk(KERN_DEBUG fmt,##arg)
  61. #else
  62. #define pr_debug(fmt,arg...) \
  63.     do { } while (0)
  64. #endif
  65.  
  66. #define pr_info(fmt,arg...) \
  67.     printk(KERN_INFO fmt,##arg)
  68.  
  69. /*
  70.  *      Display an IP address in readable format.
  71.  */
  72.  
  73. #define NIPQUAD(addr) \
  74.     ((unsigned char *)&addr)[0], \
  75.     ((unsigned char *)&addr)[1], \
  76.     ((unsigned char *)&addr)[2], \
  77.     ((unsigned char *)&addr)[3]
  78.  
  79. #endif /* __KERNEL__ */
  80.  
  81. #define SI_LOAD_SHIFT    16
  82. struct sysinfo {
  83.     long uptime;            /* Seconds since boot */
  84.     unsigned long loads[3];        /* 1, 5, and 15 minute load averages */
  85.     unsigned long totalram;        /* Total usable main memory size */
  86.     unsigned long freeram;        /* Available memory size */
  87.     unsigned long sharedram;    /* Amount of shared memory */
  88.     unsigned long bufferram;    /* Memory used by buffers */
  89.     unsigned long totalswap;    /* Total swap space size */
  90.     unsigned long freeswap;        /* swap space still available */
  91.     unsigned short procs;        /* Number of current processes */
  92.     char _f[22];            /* Pads structure to 64 bytes */
  93. };
  94.  
  95. #endif
  96.